Repository navigation
fix(github-backup): paginate queue polling (#3476) - #3484
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21a4e83fa4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| events.extend(page_events) | ||
| if page.get("list_complete", True): | ||
| return events |
There was a problem hiding this comment.
Batch acknowledgements after collecting multiple queue pages
When a backlog contains more than 1,000 ackable events, collecting every page makes main() send all their IDs in a single /queue/ack request. That Worker handler performs one awaited KV delete per ID, but Cloudflare limits each invocation to 1,000 KV operations, so the request fails after partially deleting the batch and the drainer exits with an error. Previously, the 500-event polling limit kept acknowledgements below this ceiling. Split acknowledgements into bounded requests so multi-page backlogs can drain successfully.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: acknowledgements are now sent through ack_events(), which batches ids at ACK_BATCH_SIZE = 500 per /queue/ack request — well under the Worker's 1,000-KV-operation invocation limit — so multi-page backlogs drain completely instead of failing mid-batch. Regression test in test_drain_queue.py case 15: 1,200 ackable events produce 3 bounded ack requests with every event acked (63/63 checks pass).
|
🤖 Agent note · parked (task 8248, lane code-e) Parking task 8248: the Codex gate blocks merge of PR #3484 — one undispositioned P2 finding, reverified fresh 2026-11-04 (no replies on the thread):
Resume condition: fix that finding on PR #3484 (or reply-disposition it with reasoning), then merge when the PR is mergeable and all findings are dispositioned. |
# Conflicts: # infra/github-backup/bin/drain_queue.py # infra/github-backup/tests/test_drain_queue.py
Summary
Fixes #3476
Evidence
/queuereturned the first 500 only, starving the later healthy event.python3 infra/github-backup/tests/test_drain_queue.py— 59/59 checks pass;node --test infra/github-backup/worker/test/index.test.mjs— 2/2 pass;git diff --checkpasses.Merge Danger
Door: two-way
Blast Radius: narrow
The change affects only the authenticated queue polling response and its drainer. Existing event acknowledgement policy and the 500-item per-page limit are preserved.
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
Improvements
Bug Fixes